<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
	<TITLE></TITLE>
	<META NAME="GENERATOR" CONTENT="LibreOffice 3.4  (Win32)">
	<META NAME="CREATED" CONTENT="20120625;12272246">
	<META NAME="CHANGED" CONTENT="20120625;16213381">
	<link rel="stylesheet" type="text/css" href="styles.css" />
</HEAD>
<BODY LANG="en-GB" DIR="LTR">
<div id="container">
<div id="header"><H1 CLASS="western">ABODE &ndash; Advanced Behavior Oriented Design
Environment</H1></div>
  <div id="wrapper">

  <div id="navigation">
    <p><strong>Contents</strong></p>
    <ul>
      <li><a href="#overview">Overview</a></li>
      <li><a href="#bod">BOD and POSH Intro</a></li>
      <li><a href="#intro">Introduction to ABODE</a></li>
      <li><a href="#tutorial">Quick Start Tutorial</a></li>
    </ul>
    <p><strong>Resources</strong></p>
    <ul>
      <li><a href="http://www.cs.bath.ac.uk/~jjb/web/bod.html">BOD Site</a></li>
      <li><a href="http://www.cs.bath.ac.uk/~jjb/web/posh.html">POSH Description</a></li>
    </ul>
  </div>

    <div id="content">
<P CLASS="western"><BR><BR>
</P>
<a name="overview"><H2 CLASS="western">Overview</H2></a>
<P CLASS="western">The Advanced Behavior Oriented Design Environment
(ABODE) development software is a tool for developing <A HREF="http://www.cs.bath.ac.uk/~jjb/web/posh.html">POSH</A>
(Parallel-rooted, Ordered Slip-stack Hierarchical) dynamic plans,
which are the structures used for action selection (also known as
behavior arbitration or coordination) in <A HREF="http://www.cs.bath.ac.uk/~jjb/web/bod.html">Behavior
Oriented Design (BOD)</A>. 
</P>
<P CLASS="western">A BOD AI mechanism has two components:</P>
<UL>
	<LI><P CLASS="western">A POSH dynamic plan for action selection. 
	This is a flexible, hierarchical data structure which provides
	structured intelligent control by setting an individual agent's
	priorities.</P>
	<LI><P CLASS="western">A library of Behavior Modules. The modules
	generate and control the actions of the agent, process its
	perception and store and maintain any memory required if the agent
	learns. These are referred to here as action and sense primitives
	and are the lowest level element of a POSH plan. 
	</P>
</UL>
<P CLASS="western">ABODE allows you to easily develop a POSH action
plan, which can then be used to call the action primitives that are
developed using other tools. The development of these action and
sense primitives is outside of the scope of this documentation,
however more about this can be found in the documentation for <A HREF="http://www.cs.bath.ac.uk/~jjb/web/bod.html">BOD</A>
and in this <A HREF="http://www.cs.bath.ac.uk/~jjb/web/BOD/sposh.html">POSH
implementation guide</A>.</P>
<a name="bod"><H2 CLASS="western">Behavior Oriented Design &ndash; Action Selection
with POSH</H2></a>
<P CLASS="western" ALIGN=LEFT>For a more complete overview on POSH,
<A HREF="http://www.cs.bath.ac.uk/~jjb/web/posh.html">click here</A>.</P>
<P CLASS="western">The BOD action selection mechanism <B>POSH</B><SPAN STYLE="font-weight: normal">
has two types of primitives:</SPAN></P>
<UL>
	<LI><P CLASS="western"><I><SPAN STYLE="font-weight: normal">Action</SPAN></I><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">
	primitives &ndash; These tell an agent to </SPAN></SPAN><SPAN STYLE="font-style: normal"><B>do</B></SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">
	something.</SPAN></SPAN></P>
	<LI><P CLASS="western"><I><SPAN STYLE="font-weight: normal">Sense</SPAN></I><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">
	primitives &ndash; These provide information about the world the
	agent is situated in.</SPAN></SPAN></P>
</UL>
<P CLASS="western"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">These
elements by themselves they do not provide a structured plan. These
elements are then combined into a hierarchical plan using </SPAN></SPAN><SPAN STYLE="font-style: normal"><B>POSH
aggregates</B></SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">.</SPAN></SPAN></P>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal">There
are three different types of aggregates which all work together and
provide different levels of complexity and functionality. The three
types are:</P>
<UL>
	<LI><P CLASS="western"><SPAN STYLE="font-style: normal"><B>drive
	collection:  </B></SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">this
	is the root of the POSH hierarchy, and on every POSH
	action-selection cycle, this reconsiders which goal the agent should
	be working on.  This is how a BOD agent can respond rapidly to
	changes in the environment. A drive collection is the highest level
	of a POSH plan hierarchy, and is generally used to specify
	high-level drives. A drive element is made up of a set of </SPAN></SPAN><SPAN STYLE="font-style: normal"><B>triggers</B></SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">
	which if activated will engage the </SPAN></SPAN><SPAN STYLE="font-style: normal"><B>actions
	</B></SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">of
	the drive. The actions can be </SPAN></SPAN><SPAN STYLE="font-style: normal"><B>competences
	</B></SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">and
	</SPAN></SPAN><SPAN STYLE="font-style: normal"><B>action patterns.</B></SPAN></P>
	<LI><P CLASS="western"><SPAN STYLE="font-style: normal"><B>competences:
	</B></SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">these
	are basic reactive plans.  They allow a BOD agent to complete a task
	robustly and opportunistically. A competence can be made up of
	multiple </SPAN></SPAN><SPAN STYLE="font-style: normal"><B>competence
	elements</B></SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">.
	A competence element is made up by a series of </SPAN></SPAN><SPAN STYLE="font-style: normal"><B>senses
	</B></SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">which
	when triggered will activate an action. This action can be another
	</SPAN></SPAN><SPAN STYLE="font-style: normal"><B>competence</B></SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">,
	an </SPAN></SPAN><SPAN STYLE="font-style: normal"><B>action pattern</B></SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">,
	or an </SPAN></SPAN><SPAN STYLE="font-style: normal"><B>action
	primitive</B></SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">.</SPAN></SPAN></P>
	<LI><P CLASS="western"><SPAN STYLE="font-style: normal"><B>action
	patterns: or simple sequences.</B></SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">
	 These are a basic kind of plan aggregate which turn out to be
	useful in quite a lot of situations, despite their lack of
	flexibility. An action pattern is simply a series of action
	primitives which will be performed in a sequential order. They
	reduce the combinatorial complexity of the agent when a full
	competence is not really necessary.</SPAN></SPAN></P>
</UL>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal">The
ABODE software provides a way to develop a POSH hierarchical plan
using a graphical interface, which can  then be saved as a POSH
action plan that can then be parsed and ran with the POSH software.</P>
<a name="intro"><H2 CLASS="western">Introduction to ABODE</a>
</H2>
<P CLASS="western">In this section, a brief overview of a typical
view of ABODE is provided. 
</P>
<P CLASS="western">When editing an existing file, ABODE will look
something like this:</P>
<P CLASS="western"><img src="overview.png"/></P>
<P CLASS="western">The different marked sections are as follows:</P>
<OL>
	<LI><P CLASS="western"><B>Menu bar -</B> Here you can open new
	files, save the currently open file etc.</P>
	<LI><P CLASS="western"><B>Main view &ndash; </B><SPAN STYLE="font-weight: normal">This
	is the main view which shows the currently open POSH action plan. </SPAN>
	</P>
	<LI><P CLASS="western"><B>Console &ndash;</B><SPAN STYLE="font-weight: normal">
	The output console. This provides feedback when ABODE performs
	certain actions and shows the output from tools such as the &ldquo;List
	Primitives&rdquo; operation.</SPAN></P>
	<LI><P CLASS="western"><B>POSH Elements &ndash; </B><SPAN STYLE="font-weight: normal">The
	contents of the action plan. Elements are shown in a hierarchical
	fashion, from left to right. The root node is always shown at the
	top left.</SPAN></P>
	<LI><P CLASS="western"><B>Properties and Action Pane</B><SPAN STYLE="font-weight: normal">
	&ndash; Here are most of the options that are available for editing
	the selected POSH node. When an element is selected in the </SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">main
	view, this populates with all of the available options for editing
	and manipulating that node.</SPAN></SPAN></P>
	<LI><P CLASS="western"><B><SPAN STYLE="font-style: normal">View
	Select &ndash;</SPAN></B><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">
	There are a variety of different views which can be used to view the
	POSH action plan.</SPAN></SPAN></P>
</OL>
<a name="tutorial"><H2 CLASS="western"><I><B>Quick Start Tutorial</B></I></H2></a>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal">In
this tutorial a small example will be covered that goes over how to
use most of the POSH elements in an action plan using ABODE. The
example involves making an action plan for a Monkey agent that has
two drives, one for dealing with hunger and another to fight enemies.
The first thing to do is to create a new lap file (File &rarr; New).
This will create an action plan with a root drive collection called
NewDriveCollection. We want to rename this to something more useful,
so if we click on this, we can change the name in the properties
panel on the right. Rename this to <I>monkey_drives.</I></P>
<P CLASS="western" STYLE="font-weight: normal"><I><img src="guide_01.png"/></I></P>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal">A
drive collection has a list of goals that are checked whenever the
drive collection is evaluated. If all of the goals return true, then
the agent has reached its goal and will terminate. Because of this,
we need to add a goal for the agent to work. For the monkey agent, we
want this to keep running until the monkey agent is killed, so we
will add a new goal called death. To do this, right click on the
drive collection and select &ldquo;Add Goal Sense&rdquo; and rename
it to <I>death</I>. A lot of actions in ABODE are performed though
right-click menus. Child nodes such as adding goal senses and
triggers are all added through the right click menu of the parent
node. 
</P>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal">To
prevent this untimely demise of the monkey from ever occurring, we
will add a new drive element that will cause it to eat food when
required. To do this, right click on the drive collection and select
&ldquo;Add new drive element.&rdquo; A prompt will appear asking for
the name, call it <I>hunger.</I> The action plan will now look like
this.</P>
<P CLASS="western" STYLE="font-weight: normal"><I><img src="guide_02.png"/></I></I></P>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal">For
a drive element to ever be triggered, it needs at least one sense
associated with it. For hunger, we will check whether the monkey has
eaten recently. Right click on the drive element and click &ldquo;Add
Trigger Element&rdquo;. Then click on the new trigger that was
created, and set the sense name to be something like <I>eaten_recently</I>
(if you cannot see the trigger element, you may have to change to
another view. Try switching to the Drive Collection view in the view
tabs at the top of the tree view.) The default value a sense will be
checked against is whether it returns <B>true(1). </B>However we want
the monkey to eaten when it <I>hasn't</I> eaten recently. So we can
change the predicate to be equal to 0(false), which will produce the
desired behaviour. This can be changed in the properties panel for
the sense. 
</P>
<P CLASS="western" STYLE="font-weight: normal"><I><img src="guide_03.png"/></I></P>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal">The
action that we will use to remedy the monies hunger problem will be
made up of a series of smaller actions. This is done by using an
Action Pattern. To create a new action pattern for this node, right
click on the drive element and select &ldquo;Set Triggered Action &rarr;
New Action Pattern.&rdquo; You will be prompted to name this new
action pattern, name it &ldquo;<I>eat</I>&rdquo;. This will create a
new action pattern and set it as the action for this drive element.</P>
<P CLASS="western" STYLE="font-weight: normal"><I><img src="guide_04.png"/></I></P>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal">To
add action primitives to the new action pattern, find the new action
pattern (it is easiest to locate and edit in the <B>Action Patterns
</B>view) and right click on it. Click &ldquo;Add action element&rdquo;
two times to add two elements. Rename the first to &ldquo;<I>get_banana</I>&rdquo;
and the second to &ldquo;<I>eat_banana</I>&rdquo; (in POSH all
element names must be one word, hence the underscores instead of
spaces). In POSH, actions are evaluated in order from left to right,
so this will make the agent first call the<I> get_banana</I>
primitive and then the <I>eat_banana</I> primitive if this action
pattern is called. 
</P>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal">Now
go ahead and save the file to a location of your choosing. After
saving you will be able to view the source code generated by ABODE.
This can be done by selecting the <B>source</B> tab at the top of the
viewing window. 
</P>
<P CLASS="western" STYLE="font-weight: normal"><I><img src="guide_05.png"/></I></P>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal">Notice
the &ldquo;Documentation&rdquo; element which currently has the
default text. If you would like to update this, switch to the
&ldquo;Documentation&rdquo; view tab. This lets you change the
contents of this element. 
</P>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal">To
see the complete tree in hierarchical form use the &ldquo;Logical
View.&rdquo; If you switch to this now, you should have something
which looks like this:</P>
<P CLASS="western" STYLE="font-weight: normal"><I><img src="guide_06.png"/></I></P>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal">This
view shows everything and is therefore quite useful for small plan
files such as this one. For larger files, it can be convenient to be
able to show any one type of element, which is where views such as
<B>Action Pattern</B> and <B>Drive Collections</B> are useful.</P>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal">Now
that we have a basic plan with a single drive, we will now make a
second more complex drive. This will allow our monkey agent to be
able to defend itself against hostile. To start off with, like before
create a new drive element, this time with the name &ldquo;<I>combat</I>&rdquo;.
Also like before, right click on the new drive element and add a
sense. Call this sense &ldquo;<I>nearby_monkey</I>&rdquo; and leave
the rest of the properties as they are. Add a second sense called
&ldquo;<I>nearby_monkey_is_hostile.</I>&rdquo; This second sense
means that the monkey will only engage the combat drive if a nearby
monkey is actively hostile against it. We don't want our monkey agent
to attack all of the monkeys, as that is a bad way to make friends. 
</P>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal">The
action that we are going to associate with this drive element is
going to be more complicated than the one that was used for eating,
so we are going to use a <B>competence</B> instead of an action
pattern. Right-click on the drive and set the action to be a new
competence (Set Triggered Action &rarr; New Competence). Name the new
competence &ldquo;<I>fight</I>&rdquo;.</P>
<P CLASS="western" STYLE="font-weight: normal"><I><img src="guide_07.png"/></I></P>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal">A
competence is similar to a drive collection, in that it holds a set
of smaller elements which are evaluated in order. The competence has
a goal like a drive collection and each of the competence elements
has its own triggers.</P>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal">After
creating the competence, add a new goal &ldquo;<I>defeat_opponent.</I>&rdquo;
Our monkey agent will be very civilized in combat and will only
engage opponents when wielding a weapon. To make sure this is the
case, we will add two competence elements to the competence. The
first will engage an opponent if the agent is currently wielding a
weapon, the second will make sure the monkey is currently equipped
with a weapon and if this isn't the case then will try and pick one
up. 
</P>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal">The
first competence element we will be called &ldquo;<I>engage_combat</I>.&rdquo;
Create a new competence element by right clicking on the Competence
and selecting &ldquo;Add new Competence Element.&rdquo; 
</P>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal">Add
a new trigger with a sense name of &ldquo;<I>has_weapon</I>&rdquo;
and set the action to be an action primitive with the name &ldquo;<I>combat.&rdquo;
</I>
</P>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal">Now
we need to make the monkey pick up a weapon. Create a second
competence element and name it pick_up_weapon.  
</P>
<P CLASS="western" STYLE="font-weight: normal"><I><img src="guide_08.png"/></I></P>
<P CLASS="western" STYLE="font-weight: normal"><SPAN STYLE="font-style: normal">Just
like before, add a new trigger with the sense &ldquo;</SPAN><I>has_weapon</I><SPAN STYLE="font-style: normal">&rdquo;
but this time with the predicate &ldquo;!=&rdquo; (not equals.) Note
that you can use the drop down box on the sense name to select senses
that you have used elsewhere in the file.</SPAN></P>
<P CLASS="western" STYLE="font-weight: normal"><SPAN STYLE="font-style: normal"><img src="guide_09.png"/></SPAN></P>
<P CLASS="western" STYLE="font-weight: normal"><SPAN STYLE="font-style: normal"><img src="guide_10.png"/></SPAN></P>
<P CLASS="western" STYLE="font-weight: normal"><SPAN STYLE="font-style: normal">Add
a second trigger with sense name &ldquo;</SPAN><I>near_weapon.</I><SPAN STYLE="font-style: normal">&rdquo;
This is needed so that the agent doesn't try to pick up non-existent
weapon. Then we will use an action primtiive named &ldquo;</SPAN><I>pick_up&rdquo;.</I></P>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal">For
a further exercise, feel free to update the original <I>&ldquo;eat&rdquo;
</I><SPAN STYLE="text-decoration: none">action pattern</SPAN><I><SPAN STYLE="text-decoration: none">
</SPAN></I><SPAN STYLE="text-decoration: none">with a competence that
checks that monkey isn't already holding a banana before trying to
get one.</SPAN></P>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal"><SPAN STYLE="text-decoration: none">Also
note that it is possible to rearrange elements in drive collections,
action patterns and competences. This is important due to the fact
that POSH evaluates nodes in turn, from top to bottom. As soon as one
an element is triggered successfully, POSH resets back to the top of
the hierarchy. So this allows elements to have a priority order. The
elements can be moved around using the command panel, as shown here:</SPAN></P>
<P CLASS="western" STYLE="font-weight: normal"><SPAN STYLE="font-style: normal"><SPAN STYLE="text-decoration: none"><img src="guide_11.png"/></SPAN></SPAN></P>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal"><SPAN STYLE="text-decoration: none">Another
important property is the </SPAN><SPAN STYLE="text-decoration: none"><B>frequency</B></SPAN><SPAN STYLE="text-decoration: none">.
Drive elements can be set to have a frequency of how often it will be
fired. If a frequency value is set on a drive element, once it is
triggered successfully, a timer starts and this drive element cannot
be triggered again until this timer exceeds the frequency value. This
allows lower priority drive elements to be triggered in the down time
of the higher priority tasks.</SPAN></P>
<P CLASS="western" STYLE="font-weight: normal"><SPAN STYLE="font-style: normal"><SPAN STYLE="text-decoration: none"><img src="guide_12.png"/></SPAN></SPAN></P>
<P CLASS="western" STYLE="font-style: normal; font-weight: normal">With
all of this done, we are left with a second drive element which calls
a competence with two child competence elements for dealing with
engaging enemies. Of course in a real system the action and sense
primitives will have to be programmed elsewhere in a behaviour
library so that they can be called by POSH.</P>
</div>
</div>

</div>
</BODY>
</HTML>